-
Notifications
You must be signed in to change notification settings - Fork 439
Composer plugin tasks not executed using the PHP version Composer is invoked with #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting @echernyavskiy. The composer plugin is currently indeed not taking into account what PHP version you are executing with. grumphp/src/Composer/GrumPHPPlugin.php Line 210 in d6ba4be
Care to take a dive into the code and craft a PR that fixes this? |
@veewee, yeah, that's the file I was looking at, and that's how I arrived at the conclusion above. |
@echernyavskiy It boils down to scrolling through the files in composer/composer.
The plugin has been created a long way back. Since then, composer has changed a lot. $composer = $event->getComposer();
$loop = $composer->getLoop();
$command_executor = $loop->getProcessExecutor();
$command_executor->executeTty(implode(' ', [
(new PhpExecutableFinder())->find(),
...array_map(static fn(string $argument): string => ProcessExecutor::escape($argument), [
$this->detectGrumphpExecutable(),
'arg...'
]),
])); (it should probably contain some additional logic for Windows and .exe support) |
Given:
8.2
and8.3
/usr/bin/php
invokes PHP8.2
(managed viaalternatives
), so that's the default version8.3
, i.e./usr/bin/php8.3 ./composer.phar install
In this setup GrumPHP
git:init
andconfigure
scripts are executed using PHP8.2
because the plugin callsvendor/bin/grumphp
directly instead of using the PHP binary Composer is using for the current invocation.I'm not familiar with Composer Plugin API enough to tell if Composer exposes internally the PHP binary it was invoked with. However it looks like there is
@php
syntax for scripts that does something similar to what${MAKE}
would do in a Makefile, so Composer must maintain some sort of reference to the current PHP binary.The text was updated successfully, but these errors were encountered: